

function display_at_freq_domain( Fs,y,fmax,titlePrint,legendText,PlotString)
%DISPLAY_AT_FREQ_DOMAIN Summary of this function goes here
%   Detailed explanation goes here

    Len = length(y);                     % Length of signal
    NFFT = 2^nextpow2(Len); % Next power of 2 from length of y
if (size(y,1) ==1)
    Y = fftshift(fft(y,NFFT)/Len);
else
    for k=1:size(y,1)
        Y(k,:) = fftshift(fft(y(k,:),NFFT)/Len);    
    end
end

    fvec = Fs/2*linspace(-1,1,NFFT);

    %Plot Double-sided amplitude spectrum.
%     figure;
    plot(fvec,2*abs(Y),PlotString) ;
    title(titlePrint);
    xlabel('Frequency (Hz)');
    ylabel('Amplitude');
    xlim([-fmax,fmax]);
    legend(legendText);
    figure;
    plot(fvec,angle(Y));
end